//
//  TarileCuCarteaVerdeViewController.m
//  RCA24
//
//  Created by Raul Pacurar on 2/11/12.
//  Copyright (c) 2012 Comknow. All rights reserved.
//

#import "TarileCuCarteaVerdeViewController.h"

@implementation TarileCuCarteaVerdeViewController

@synthesize countriesTableView;
@synthesize backButton;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    UIImage * backgroundPattern = [UIImage imageNamed:@"bg-app.png"];
    [self.view setBackgroundColor:[UIColor colorWithPatternImage:backgroundPattern]];
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

- (void)dealloc
{
    [super dealloc];
    
    [countriesTableView release];
    [backButton release];
}

#pragma mark Table

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 44;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 7;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";
    
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
    }

    
    if(indexPath.row == 0)
    {
        cell.textLabel.text = @"Albania";
    }
    else if(indexPath.row == 1)
    {
        cell.textLabel.text = @"Bulgaria";
    }
    else if(indexPath.row == 2)
    {
        cell.textLabel.text = @"Austria";
    }
    else if(indexPath.row == 3)
    {
        cell.textLabel.text = @"Andorra";
    }
    else if(indexPath.row == 4)
    {
        cell.textLabel.text = @"Belgium";
    }
    else if(indexPath.row == 5)
    {
        cell.textLabel.text = @"Cyprus";
    }
    else if(indexPath.row == 6)
    {
        cell.textLabel.text = @"Czech Republic";
    }

        
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:NO];
    
    SocietatiCarteVerdeViewController *societatiCarteVerdeViewController = [[SocietatiCarteVerdeViewController alloc] init];
    
    [self.navigationController pushViewController:societatiCarteVerdeViewController animated:true];
    
    //[societatiCarteVerdeViewController release];

    
}

- (IBAction)buttonPressed:(id)sender
{
    if(sender == backButton)
    {
        [self.navigationController popViewControllerAnimated:true]; 
    }
}



@end
